<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
<!--
	function back(){
		window.location.href = "./backupManage.do";
		window.location.target = "main";
	}
	
	function showHidden(){
		var backupCycle = document.all.backupCycle.value;
		if(backupCycle == '2'){
			document.getElementById("tWeek").style.display = "block";
		}else{
			document.getElementById("tWeek").style.display = "none";
		}
	}
	
	function save(){
		document.autoBackupForm.action = "./backupManage.do?action=autoBackup";
		document.autoBackupForm.target = "main";
		document.autoBackupForm.submit();
	}
	
	function initPage(){
		if("<c:out value='${result}'/>" == 1){
			alert("保存成功！");
		}
		
		/**if("<c:out value='${backupForm.backupCycle}'/>" == 2){
			document.getElementById("tWeek").style.display = "block";
		}*/
		showHidden();
	}
-->
</script>
</head>
<body onload="initPage()">
<form name="autoBackupForm" action="" method="post">
	<table class="table_frame" cellpadding="0" cellspacing="0">
		<tr>
			<td>
				<table class="table_title" cellpadding="0" cellspacing="0">
					<tr>
						<td class="title_lab" colspan="3">
							&nbsp;&nbsp;&nbsp;&nbsp;自动备份设置
						</td>
					</tr>
					<tr><td height="15"></td></tr>
					<tr>
						<td valign="bottom">&nbsp;
							<a href="javascript:save();" title="保存" hidefocus="true">保存</a>
						</td>
						<td valign="bottom" align="right">
							<a href="javascript:back();" title="返回" hidefocus="true">返回</a>&nbsp;&nbsp;&nbsp;&nbsp;
						</td>
					</tr>
					<tr><td height="2"></td></tr>
				</table>
			</td>
		</tr>
		<tr>
			<td height="5"></td>
		</tr>
		<tr>
			<td>
				<table class="table1">
					<tr>
						<td>
							<table class="table_input" cellpadding="0" cellspacing="0" style="margin: 0 0 0 50px;">
								<tr>
									<td colspan="3"></td>
								</tr>
								<tr>
									<td colspan="3">
										目前执行的备份计划：
									<c:choose>
										<c:when test="${empty backupForm}">每年1月1日的00时00分</c:when>
										<c:otherwise>
											<c:choose>
												<c:when test="${backupForm.backupCycle == '1'}">每天</c:when>
												<c:when test="${backupForm.backupCycle == '2'}">每周</c:when>
											</c:choose>
											<c:choose>
												<c:when test="${backupForm.week == 'MON'}">一</c:when>
												<c:when test="${backupForm.week == 'TUE'}">二</c:when>
												<c:when test="${backupForm.week == 'WED'}">三</c:when>
												<c:when test="${backupForm.week == 'THU'}">四</c:when>
												<c:when test="${backupForm.week == 'FRI'}">五</c:when>
												<c:when test="${backupForm.week == 'SAT'}">六</c:when>
												<c:when test="${backupForm.week == 'SUN'}">日</c:when>
											</c:choose>
											的${backupForm.hour}时${backupForm.minute}分
										</c:otherwise>
									</c:choose>
									</td>
								</tr>
								<tr>
									<td colspan="3">备份文件存放路径：${backupPath}</td>
								</tr>
								<tr>
									<td colspan="3"></td>
								</tr>
								<tr>
									<td width="15%">备份周期：</td>
									<td width="50%">
										<select id="backupCycle" name="backupCycle" onchange="showHidden()">
											<option value="1" <c:if test='${backupForm.backupCycle == 1}'>selected</c:if> >天
												&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											</option>
											<option value="2" <c:if test='${backupForm.backupCycle == 2}'>selected</c:if> >周</option>
											<!-- 
											<option value="3">月</option>
											 -->
										</select>
									</td>
									<td></td>
								</tr>
								<tr id="tWeek" style="display: none;">
									<td width="15%">备份日期：</td>
									<td width="50%">
										<select id="week" name="week">
					     					<option value="MON" <c:if test='${backupForm.week == "MON"}'>selected</c:if> >星期一
					     						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					     					</option>
					     					<option value="TUE" <c:if test='${backupForm.week == "TUE"}'>selected</c:if> >星期二</option>
					     					<option value="WED" <c:if test='${backupForm.week == "WED"}'>selected</c:if> >星期三</option>
					     					<option value="THU" <c:if test='${backupForm.week == "THU"}'>selected</c:if> >星期四</option>
					     					<option value="FRI" <c:if test='${backupForm.week == "FRI"}'>selected</c:if> >星期五</option>
					     					<option value="SAT" <c:if test='${backupForm.week == "SAT"}'>selected</c:if> >星期六</option>
					     					<option value="SUN" <c:if test='${backupForm.week == "SUN"}'>selected</c:if> >星期日</option>
					     				</select>
									</td>
									<td></td>
								</tr>
								<tr>
									<td width="15%">备份时间：</td>
									<td width="50%">
										<select id="hour" name="hour">
											<c:forEach var="i" begin="0" end="23" step="1">
					     					<option value="${i}" <c:if test='${backupForm.hour == i}'>selected</c:if> >${i}&nbsp;&nbsp;</option>
					     					</c:forEach>
					     				</select>&nbsp;时&nbsp;&nbsp;&nbsp;&nbsp;
										<select id="minute" name="minute">
					     					<c:forEach var="i" begin="0" end="59" step="1">
					     					<option value="${i}" <c:if test='${backupForm.minute == i}'>selected</c:if> >${i}&nbsp;&nbsp;</option>
					     					</c:forEach>
					     				</select>&nbsp;分
									</td>
									<td></td>
								</tr>
								<tr>
									<td colspan="3"></td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>
</body>
</html>